CC:=gcc
# -g 开启gdb的debug调试（生成的二进制文件中包含调试信息）
# -O0 禁用优化（确保调试一致性）
# -Wall 显示所有警告
CFLAGS := -g -O0 -Wall
log:=thirdparty/log/log.h thirdparty/log/log.c

log_test: test/log_test.c $(log)
	-$(CC) $(CFLAGS) $^ -o $@ -I thirdparty
#	-./$@
#	-rm $@

json:=thirdparty/cJSON/cJSON.h thirdparty/cJSON/cJSON.c
json_test: test/json_test.c $(json) $(log)
	-$(CC) $^ -o $@ -I thirdparty
	-./$@
	-rm $@

app_common:= app/app_common.h app/app_common.c
app_common_test: test/app_common_test.c $(log) $(app_common)
	-$(CC) $^ -o $@ -I thirdparty -Iapp
	-./$@
	-rm $@


app_message:= app/app_message.h app/app_message.c
app_message_test: test/app_message_test.c $(app_message) $(log) $(app_common) $(json)
	-$(CC) $^ -o $@ -I thirdparty -Iapp
	-./$@
	-rm $@

mqtt_test: test/mqtt_test.c
	-$(CC) $^ -o $@ -l paho-mqtt3c
	-./$@
	-rm $@

app_mqtt:= app/app_mqtt.h app/app_mqtt.c
app_mqtt_test: test/app_mqtt_test.c $(app_mqtt) $(log)
	-$(CC) $^ -o $@ -I app -Ithirdparty -l paho-mqtt3c
	-./$@
	-rm $@

app_pool:= app/app_pool.h app/app_pool.c
app_pool_test: test/app_pool_test.c $(app_pool) $(log)
	-$(CC) $^ -o $@ -I app -Ithirdparty
	-./$@
	-rm $@
# -I 给gcc指定include path
# $^ 表示所有依赖
# $@ 表示目标名











